package com.heima.behavior.service.impl;

import com.heima.behavior.dto.FollowBehaviorDto;
import com.heima.behavior.entity.ApFollowBehavior;
import com.heima.behavior.service.IApFollowBehaviorService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class ApFollowBehaviorServiceImpl implements IApFollowBehaviorService {

    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public void saveFollow(FollowBehaviorDto dto) {
        ApFollowBehavior followBehavior = new ApFollowBehavior();
        BeanUtils.copyProperties(dto, followBehavior);
        followBehavior.setCreatedTime(new Date());
        mongoTemplate.save(followBehavior);
    }
}
